<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/common/header.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script type="text/javascript" src="../../js/deptSingleSelect.js"></script>
<script type="text/javascript" src="../../js/roleSingleSelect.js"></script>
<a href="" title="权限管理——意见栏"></a>
<script type="text/javascript">

Ext.onReady(function(){
    Ext.BLANK_IMAGE_URL = ' ../../js/ext/images/default/s.gif'; 
    // ---------------------- Global vars and functions------------------------------
    Ext.SERVER = '<c:url value="/"/>';
  
  Ext.QuickTips.init();
    Ext.override(Ext.form.Field, 
    {   afterRender : Ext.form.Field.prototype.afterRender.createSequence(function()
        {
            var qt = this.qtip;
            if (qt)
            {   Ext.QuickTips.register({
                target:  this,
                title: '',
                css : 'background:#ff0000;',
                text: qt,
                enabled: true,
                showDelay: 20
                });
            }
        })
    });
    
    //-------------------commbobox------------------
     var masterFrom_SYSTEMNAME = new Ext.form.ComboBox({
        name: 'SYSTEMNAME',
        hiddenName: 'SYSTEMNAME',
        fieldLabel: '应用系统',
        typeAhead: true,
        allowBlank: false,
        triggerAction: 'all',
        lazyRender: true,
        mode: 'local',
        store: new Ext.data.ArrayStore({
            id: 'key',
            fields: [ 'key', 'value'],
            data: [
                [ '权限系统', '权限系统'],
                [ 'OA系统', 'OA系统'],
                [ '学工系统', '学工系统'],
                [ '其他','其他']
            ]
        }),
        valueField: 'key',
        displayField: 'value'
    });
    
    var masterFrom_COMMENTTYPE = new Ext.form.ComboBox({
        name: 'COMMENTTYPE',
        hiddenName: 'COMMENTTYPE',
        fieldLabel: '样式',
        allowBlank: false,
        typeAhead: true,
        triggerAction: 'all',
        lazyRender: true,
        mode: 'local',
        store: new Ext.data.ArrayStore({
            id: 'key',
            fields: [ 'key', 'value'],
            data: [
                [ '颜色', '颜色'],
                [ '布局', '布局'],
                ['其他','其他']
            ]
        }),
        valueField: 'key',
        displayField: 'value'
    });
	var panle=new Ext.Panel({
    id: 'id1',
    name: 'id1',
   	layout:'form',
    html:'<a href="<%=basePath%>help/yjl.jsp" target="_blank">帮助</a>'
    })
   //---------------------form-------------------
    
      var masterFrom = new Ext.form.FormPanel({
        buttonAlign:'left',
        frame: true,
        layout: 'form',
        labelWidth: 70,
        autoScroll:'true',
        items: [
                 {
                     xtype: 'textfield',
                     name: 'ID',
                     inputType: 'hidden',
                     fieldLabel: '编号'
                 },
                {
                	xtype: 'textfield',
                    name: 'USERREALNAME',
                    inputType: 'hidden',
                    fieldLabel: '姓名'
                },
                 {
                    xtype: 'textfield',
                    name: 'USERDEPARTMENTNAME',
                    id: 'USERDEPARTMENTNAME',
                    inputType: 'hidden',
                    fieldLabel: '部门'
                },
                {
                	xtype: 'textfield',
                    name: 'USERLOGINID',
                    inputType: 'hidden',
                    fieldLabel: '用户登录名'
                },
                masterFrom_SYSTEMNAME,
                masterFrom_COMMENTTYPE,
              new  Ext.form.TextArea({    //TextArea
             			  layout: 'form',
                          fieldLabel:'意见或建议',
                          
                          name:'COMMENTNOTES',
                          height:90,
                          width:300,
                          maxLength:600,
                          id: 'userNotes',
                          enableKeyEvents:true
                      })
             ],
        buttons: [
            {
                text: '发送',
                handler: function(){
                    if(masterFrom.getForm().isValid()){
                        masterFrom.getForm().submit({
                            url: '<c:url value="/comment/comment.do" />',
                            waitTitle: '请等待',                            
                            waitMsg: '信息提交中...',
                            timeout: 30,
                            success: function(response, action){
                            	text = action.response.responseText;
                                    json = Ext.decode(text);
				                    if(json.success == true){  
                                        Ext.Msg.alert('提示', json.message);
				                    } else {
				                        Ext.Msg.alert('提示', '谢谢你提交意见!');
				                    }  							      
                            },
						    failure: function(response, action) {
				                    text = action.response.responseText;
                                    json = Ext.decode(text);
				                    if(json.success == false){  
                                        Ext.Msg.alert('提示', json.message);
				                    } else {
				                        Ext.Msg.alert('提示', '提交失败');
				                    }        
				                                                
				              }
                        });
                    }
                }
            },
            {
            	text:'重置',
            	handler:function()
            	{
            		masterFrom.getForm().reset();
            	}
            },
             panle
        ]
    });
    
//-----------------Viewport------------
        var viewport = new Ext.Viewport({
        layout: 'fit',
        border: true, 
        autoScroll: true,  
        items: [
                    masterFrom
                ]
    });
     
   });   
     
</script>
<%@ include file="/WEB-INF/views/common/footer.jsp"%>
